package com.bawei.rk_01.Login

import androidx.lifecycle.viewModelScope
import com.bawei.base.utils.SingLiveData
import com.bawei.base.utils.bean.Res
import com.bawei.base.utils.bean.UserEntity
import com.bawei.base.utils.mvvm.BaseViewModel
import kotlinx.coroutines.launch

class UserViewModel : BaseViewModel() {

    val usersuccess = SingLiveData<Res<UserEntity>>()
    val userfail = SingLiveData<String>()

    fun userInfo(){
        viewModelScope.launch {
            try {
                usersuccess.postValue(apiService.userIfo())
            }catch (e:Exception){
                userfail.postValue(e.message.toString())
            }
        }
    }

}